home *** CD-ROM | disk | FTP | other *** search
- Path: magnus.acs.ohio-state.edu!mail-news-gateway
- From: tsv@cs.umanitoba.ca (R.Ganesan)
- Newsgroups: comp.lang.c++
- Subject: gcc does not inline template member functions!
- Date: 22 Mar 1996 00:10:19 -0500
- Organization: The Ohio State University
- Sender: root@magnus.acs.ohio-state.edu
- Message-ID: <199603220508.AAA13769@polarmet.mps.ohio-state.edu>
- Reply-To: tsv@cs.umanitoba.ca
- NNTP-Posting-Host: charm.magnus.acs.ohio-state.edu
-
-
- Hi,
-
- I was surprised to find that gcc does not inline template member
- functions. It doesn't inline function templates either. I have checked the
- assembler output of gcc-2.7.2 (with -O6) on a DEC Alpha running OSF/1 3.0,
- on an 486 PC running NetBSD 1.0, and gcc-2.6.3 on a Sun3.
-
- Check the assembler output of the following trivial program and you'll
- see a function call for (mangled) sum. This seems to be a big drawback in
- using templates with gcc. Will 2.8.0 do inlining for templates? Please CC
- replies to me. Thank you.
-
- ----
-
- template <class T>
- inline int
- sum(T a, T b) { return a + b; }
-
- int
- main()
- {
- sum(1, 2);
- }
-
- -- R. Ganesan
-
- ---
- -----------------------------------------------------------------------------
- | R. Ganesan, | Email: tsv@cs.umanitoba.ca |
- | M.Tech (CSE), | Specify subject as: To Ganesan |
- | IIT-Kanpur, India | (This is actually a proxy address :-) |
- -----------------------------------------------------------------------------
-
-
-
-